# -*-coding:utf-8 -*-
# 通过调用命令行进行调试
# 调用execute这个函数可调用scrapy脚本
from scrapy.cmdline import execute

import os
import sys
# 设置工程路径，在cmd 命令更改路径而执行scrapy命令调试
# 获取main文件的父目录，os.path.abspath(__file__) 为__file__文件目录
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
# execute(["scrapy", "crawl", "Juejin", "-a", "text=html", "-a", "total_page=5", "-a", "t_id=1234567"])
# execute(["scrapy", "crawl", "Jianshu", "-a", "text=html", "-a", "total_page=5"])
# execute(["scrapy", "crawl", "OpenChina", "-a", "text=html", "-a", "total_page=1"])
# execute(["scrapy", "crawl", "SegmentFault", "-a", "text=Spark", "-a", "total_page=1"])
# execute(["scrapy", "crawl", "GZ_Lib", "-a", "text=Spark", "-a", "page=1"])
execute(["scrapy", "crawl", "school_library", "-a", "text=Hadoop", "-a", "page=1", "-a", "t_id=12346"])

# Flask那边有点问题
# execute(["scrapy", "crawl", "Juejin", "-a", 'json_data={"text": "Spark", "t_id": "1234567", "tp": 5}'])


